﻿#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h> //信号处理
#include <pthread.h> //线程
#include <semaphore.h>

struct threadpool
{
	sem_t semw;
	sem_t semr;
	pthread_mutex_t mutex;

	struct queue* que;
	pthread_t* tids;
	int queue_length_max;
};//线程池结构体
struct threadpool* create_threadpool(int threads, int queue_length, void* (*consumer)(void*));
void destroy_threadpool(struct threadpool* p, int threads);